<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
        <title>后台面板</title>
        <link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.4.2/css/amazeui.min.css">
        <style>
            body{background-color:#eee;}
            p{padding:5px;}
            hr{border:5px solid white;}
        </style>
    </head>
    <body>
        
        <header data-am-widget="header" class="am-header am-header-default">
            <h1 class="am-header-title">
                <a href="#title-link" class="">
                    后台面板
                </a>
            </h1>
        </header>
        
        <p>
            <button type="button" class="am-btn am-btn-success" onclick="location.href='sign/edit?id=0'">添加签到表</button>
            <button type="button" class="am-btn am-btn-success" onclick="location.href='account'">用户信息管理</button>
       </p>
       <hr>
       
       <div id="content"></div>
       <script id="t" type="text/html"></script>
        <script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
        <script src="http://cdn.amazeui.org/amazeui/2.4.2/js/amazeui.min.js"></script>
        <script src="/static/template.js"></script>
        <script>
            $(document).ready(function(data){
                $.AMUI.progress.inc();
                $.get("/static/1.html", {}, function(data){
                    $("#t").html(data);
                    $.get("/admin/sign/getAll", {}, function(obj){
                        var html = template("t", {"tables": obj});
                        $("#content").html(html);
                        $.AMUI.progress.done(true);
                    });
                });
            });
            
            function buildCode(index){
                $.AMUI.progress.inc();
                var token = $("#token-"+index).val();
                $.get("/admin/sign/buildCode", {"token": token}, function(obj){
                    $("#code-"+index).html("签到码："+obj['code']);
                    $("#code-expiredTime-"+index).html("签到码有效期："+obj['expiredTime']);
                    $.AMUI.progress.done(true);
                });
            }
            
        </script>
    </body>
</html>
